<script>
import { reactive } from "@vue/reactivity";
import { getShopData } from "../api/index";
import { onMounted, watch } from "@vue/runtime-core";
export default {
 
  setup(props) {
    console.log("获取数据", props.inpvalue);

    let data = reactive({
      shopData: "",
      list: [],
    });

    getShopData().then((vl) => {
      data.shopData = vl.listData;
      console.log(vl);
    });

    // let aa = () => {
    //   console.log(props.inpvalue);
    // };
    // let  tolist = ()=>{
    //     return data.shopData.filter((item) =>
    //         item.title.includes(props.inpvalue)
    //       );
    // }

    watch(
      () => props.inpvalue,
      () => {
        data.list = data.shopData.filter((item) =>
          item.title.includes(props.inpvalue)
        );
      },
      { deep: true, immediate: true }
    );
    onMounted(() => {});

    return {
      data,
      // aa,
      // tolist,
    };
  },
};
</script>

<template>
  <div class="searchResult">
  
  </div>
</template>

<style lang="scss" scoped>

</style>